<?php
class WTinymce extends CWidget {
	var $assets = '';
	var $options = array();
	var $model;
	var $name;
	var $skin = 'default';
	protected $error = false;
	
	
	public function init(){
		$this->assets = Yii::app()->assetManager->publish(dirname(__FILE__).DIRECTORY_SEPARATOR.'assets', false, -1, true);
		
		$cs = Yii::app()->getClientScript();
		$cs->registerCoreScript('jquery');
		$cs->registerScriptFile($this->assets.'/jquery.tinymce.js');

		if($this->model->getError($this->name)) 
			$this->error = true;

	}
	
	public function run(){
		$this->render($this->skin);
	}
}